﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="OtherControls_Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:strcon %>" 
            DeleteCommand="DELETE FROM [Manufacturer] WHERE [MId] = @original_MId" 
            InsertCommand="INSERT INTO [Manufacturer] ([MName], [Address], [Email], [Phone], [Describe], [Logo], [Lang], [Active]) VALUES (@MName, @Address, @Email, @Phone, @Describe, @Logo, @Lang, @Active)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [Manufacturer] WHERE ([MName] LIKE '%' + @MName + '%')" 
            UpdateCommand="UPDATE [Manufacturer] SET [MName] = @MName, [Address] = @Address, [Email] = @Email, [Phone] = @Phone, [Describe] = @Describe, [Logo] = @Logo, [Lang] = @Lang, [Active] = @Active WHERE [MId] = @original_MId">
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox1" Name="MName" PropertyName="Text" 
                    Type="String" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="original_MId" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="MName" Type="String" />
                <asp:Parameter Name="Address" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="Describe" Type="String" />
                <asp:Parameter Name="Logo" Type="String" />
                <asp:Parameter Name="Lang" Type="String" />
                <asp:Parameter Name="Active" Type="Int32" />
                <asp:Parameter Name="original_MId" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="MName" Type="String" />
                <asp:Parameter Name="Address" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="Describe" Type="String" />
                <asp:Parameter Name="Logo" Type="String" />
                <asp:Parameter Name="Lang" Type="String" />
                <asp:Parameter Name="Active" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
        Enter<br />
        Enter name<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
&nbsp;<asp:Button ID="Button1" runat="server" Text="Search" />
&nbsp;<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" DataKeyNames="MId" DataSourceID="SqlDataSource1">
            <RowStyle ForeColor="#000066" />
            <Columns>
                <asp:BoundField DataField="MId" HeaderText="MId" InsertVisible="False" 
                    ReadOnly="True" SortExpression="MId" />
                <asp:BoundField DataField="MName" HeaderText="MName" SortExpression="MName" />
                <asp:BoundField DataField="Address" HeaderText="Address" 
                    SortExpression="Address" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
                <asp:BoundField DataField="Describe" HeaderText="Describe" 
                    SortExpression="Describe" />
                <asp:BoundField DataField="Logo" HeaderText="Logo" SortExpression="Logo" />
                <asp:BoundField DataField="Lang" HeaderText="Lang" SortExpression="Lang" />
                <asp:BoundField DataField="Active" HeaderText="Active" 
                    SortExpression="Active" />
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
        </asp:GridView>
    
    </div>
    </form>
</body>
</html>
